import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { NestExpressApplication } from '@nestjs/platform-express';
import { ResponseIntercept } from './config/responseIntercept';
import { ErrorIntercept } from './config/errorIntercept';
async function bootstrap() {
  // const app = await NestFactory.create(AppModule);
  // await app.listen(3000);
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  app.enableCors(); //跨域
  app.setGlobalPrefix('api'); // 设置全局前缀
  app.useGlobalInterceptors(new ResponseIntercept()); // 设置全局响应拦截器
  app.useGlobalFilters(new ErrorIntercept()); // 设置全局异常拦截器
  await app.listen(3000);
}
bootstrap();
